package com.jews.common.mapper;

import com.jews.common.constants.ValidStatus;

/**
 * 公共的枚举映射器
 *
 * @author JewsChen
 * @title: GenericEnumMapper
 * @date 2022/11/27 23:19
 */
public class GenericEnumMapper {

    public Integer asInteger(ValidStatus status) {
        return status.getCode();
    }

    public ValidStatus asValidStatus(Integer code) {
        return ValidStatus.of(code).orElse(ValidStatus.INVALID);
    }
}
